<?php
/**
 * Description of StatusService
 *
 * @author Magno
 */
class StatusService {

    private $statusDAO;
    public function __construct() {
        $this->statusDAO = new StatusDAO();
    }

    public function salvar($status) {
        try {
            return $this->statusDAO->salvar($status);
        }catch(Exception $err) {
            throw new Exception($err->getMessage());
        }
    }

    public function excluir($statusID) {

        try {
            if(!isset ($statusID) || $statusID <= 0)
                throw new Exception("Codigo do Status Nao Econtrado!!!");

            $this->statusDAO->excluir($statusID);
        }catch(Exception $err) {
            throw new Exception($err->getMessage());
        }
    }

    public function listar($pagina = 0,$tipo = "") {
        try {
            return $this->statusDAO->listar($pagina, $tipo);
        }catch(Exception $err) {
            throw new Exception($err->getMessage());
        }
    }

    public function buscarPorID($statusID) {
        try {
            if(!isset ($statusID) || $statusID <= 0)
                throw new Exception("Codigo do Status Nao Econtrado!!!");
            return $this->statusDAO->buscarPorID($statusID);
        }catch(Exception $err) {
            throw new Exception($err->getMessage());
        }
    }

    public function total($tipo = "") {
        try {
            return $this->statusDAO->total($tipo);
        }catch(Exception $err) {
            throw new Exception($err->getMessage());
        }
    }
}
?>
